﻿using Microsoft.AspNet.Identity;
using mvcForum.Core.Abstractions.Interfaces;
using MVCForum.Web.Identity.EF.Entities;
using System;
using System.Threading.Tasks;

namespace MVCForum.Web.Identity.EF {

	public class MVCForumUserManager : UserManager<User> {
		private readonly IConfiguration configuration;

		public MVCForumUserManager(IConfiguration config, IUserStore<User> userStore)
			: base(userStore) {

			this.configuration = config;
			// TODO Get settings for password etc!!
		}

		public override Task<User> FindAsync(String userName, String password) {
			User user = base.FindAsync(userName, password).Result;
			if (user != null) {
				// TODO: Handle locked, approved, password failures etc etc.
			}

			return Task.FromResult<User>(user);
		}

	}
}